import { createRouter, createWebHistory } from "vue-router";
import NotFound from "../pages/NotFound.vue";
import TheIndex from "../pages/TheIndex.vue";
import UserPage from "../pages/UserPage.vue";
import SearchPage from "../pages/SearchPage.vue";

const index_router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: "/",
      redirect: "/index",
    },
    {
      path: "/index",
      name: "index",
      component: TheIndex,
    },
    {
      path: "/:notFound(.*)",
      component: NotFound,
    },
    {
      path: "/UserPage/:id",
      name: "UserPage",
      component: UserPage,
    },
    {
      path: "/SearchPage/:search",
      name: "SearchPage",
      component: SearchPage,
      props: true, // Pass route parameters as props
    },
  ],
});

export default index_router;
